'''
Created on Apr 3, 2014

@author: Eric
'''

def memoize(f):
    f._cache = {}
    
    def internal(*args):
        if args not in f._cache:
            f._cache = f(*args)
        return f._cache[args]
    
    return internal
